﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace GPCSC.Web.CL_ROLE_S
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				#warning 代码生成提示：显示页面,请检查确认该语句是否正确
				ShowInfo();
			}
		}
			
	private void ShowInfo()
	{
		GPCSC.BLL.CL_ROLE_S bll=new GPCSC.BLL.CL_ROLE_S();
		GPCSC.Model.CL_ROLE_S model=bll.GetModel();
		this.lblCL_ROLE_SOID.Text=model.CL_ROLE_SOID.ToString();
		this.txtROLENAME.Text=model.ROLENAME;
		this.txtREMARK.Text=model.REMARK;
		this.txtstatus.Text=model.status.ToString();
		this.txtDepth.Text=model.Depth.ToString();
		this.lblCL_PARROLEID_PK.Text=model.CL_PARROLEID_PK.ToString();
		this.txtPARROLENAME.Text=model.PARROLENAME;
		this.txtRolekind.Text=model.Rolekind.ToString();

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtROLENAME.Text.Trim().Length==0)
			{
				strErr+="ROLENAME不能为空！\\n";	
			}
			if(this.txtREMARK.Text.Trim().Length==0)
			{
				strErr+="REMARK不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtstatus.Text))
			{
				strErr+="status格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtDepth.Text))
			{
				strErr+="Depth格式错误！\\n";	
			}
			if(this.txtPARROLENAME.Text.Trim().Length==0)
			{
				strErr+="PARROLENAME不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtRolekind.Text))
			{
				strErr+="Rolekind格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			Guid CL_ROLE_SOID= new Guid(this.lblCL_ROLE_SOID.Text);
			string ROLENAME=this.txtROLENAME.Text;
			string REMARK=this.txtREMARK.Text;
			int status=int.Parse(this.txtstatus.Text);
			int Depth=int.Parse(this.txtDepth.Text);
			Guid CL_PARROLEID_PK= new Guid(this.lblCL_PARROLEID_PK.Text);
			string PARROLENAME=this.txtPARROLENAME.Text;
			int Rolekind=int.Parse(this.txtRolekind.Text);


			GPCSC.Model.CL_ROLE_S model=new GPCSC.Model.CL_ROLE_S();
			model.CL_ROLE_SOID=CL_ROLE_SOID;
			model.ROLENAME=ROLENAME;
			model.REMARK=REMARK;
			model.status=status;
			model.Depth=Depth;
			model.CL_PARROLEID_PK=CL_PARROLEID_PK;
			model.PARROLENAME=PARROLENAME;
			model.Rolekind=Rolekind;

			GPCSC.BLL.CL_ROLE_S bll=new GPCSC.BLL.CL_ROLE_S();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
